package com.fhz.a2102shopjava.ui.goods;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

import com.fhz.a2102shopjava.callback.ApiResponse;
import com.fhz.a2102shopjava.entity.Orders;
import com.fhz.a2102shopjava.entity.ShoppingCart;

import java.util.List;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;


@HiltViewModel
public class GoodsViewModel extends ViewModel {

    @Inject
    GoodsRepository mGoodsRepository;

    @Inject
    public GoodsViewModel() {
    }

    public LiveData<ApiResponse<List<ShoppingCart>>> getAllByUserId(int userId){
        return mGoodsRepository.getAllByUserId(userId);
    }

    public LiveData<ApiResponse<ShoppingCart >> updateNum(int cartId,  int num){
        return mGoodsRepository.updateNum(cartId, num);
    }
}